<template>
  <div>
    <button @click="componentName = 'DynamicComponent1'">切换到1</button>
    <button @click="componentName = 'DynamicComponent2'">切换到2</button>
    <component :is="componentName" />
  </div>
</template>

<script>
import DynamicComponent1 from './动态小组件1.vue';
import DynamicComponent2 from './动态小组件2.vue';

export default {
  components: {
    DynamicComponent1,
    DynamicComponent2,
  },
  data () {
    return {
      componentName: 'DynamicComponent1',
    };
  },
}
</script>

<style scoped>

</style>